package ru.dc.gui.swing.util;

import org.apache.commons.io.FilenameUtils;
import ru.dc.object.FileInfo;

import javax.swing.*;
import java.awt.*;

/**
 * <pre>
 * User: Penkov Vladimir
 * Date: 09.11.2010
 * Time: 10:40:23
 * </pre>
 */
public class FileInfoRenderer extends FilenameRenderer {

    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        if (value!=null && value instanceof FileInfo) {
            FileInfo filename = (FileInfo) value;
            return super.getTableCellRendererComponent(table, filename.getName(), isSelected, hasFocus, row, column);
        }
        else {
            return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
        }
    }
    

}
